<?php

function combinaison_connexion_valide($mbr_nom, $mbr_mdp) {

	$pdo = PDO2::getInstance();

	$requete = $pdo->prepare("SELECT mbr_id FROM membres
		WHERE
		mbr_nom = :mbr_nom AND 
		mbr_mdp = :mbr_mdp");

    
  
	$requete->bindValue(':mbr_nom', $mbr_nom);
	$requete->bindValue(':mbr_mdp', $mbr_mdp);
	$requete->execute();
	
	if ($result = $requete->fetch(PDO::FETCH_ASSOC)) {
	
		$requete->closeCursor();
		return $result['mbr_id'];
	}
	return false;
}

function lire_infos_utilisateur($mbr_id) {

	$pdo = PDO2::getInstance();

	$requete = $pdo->prepare("SELECT mbr_nom, mbr_mdp, mbr_email, mbr_avatar, mbr_date_inscription, ville_id
		FROM membres
		WHERE
		mbr_id = :mbr_id");

	$requete->bindValue(':mbr_id', $mbr_id);
	$requete->execute();
	
	if ($result = $requete->fetch(PDO::FETCH_ASSOC)) {
	
		$requete->closeCursor();
		return $result;
	}
	return false;
}

?>

